package com.booking.springrestful.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 对于咨询师的分析表
 * @TableName useranalytics
 */
@TableName(value ="useranalytics")
@Data
public class Useranalytics implements Serializable {
    /**
     * 唯一标识分析记录
     */
    @TableId(type = IdType.AUTO)
    private Integer analyticsid;

    /**
     * 关联用户ID
     */
    private Integer userid;

    /**
     * 咨询师id
     */
    private Integer counselorid;

    /**
     * 总预约次数
     */
    private Integer totalappointments;

    /**
     * 已完成预约次数
     */
    private Integer completedappointments;

    /**
     * 已取消预约次数
     */
    private Integer canceledappointments;

    /**
     * 平均评分
     */
    private BigDecimal averagerating;

    /**
     * 最后一次咨询时间
     */
    private Date lastconsultation;

    /**
     * 创建时间
     */
    private Date createdat;

    /**
     * 更新时间
     */
    private Date updatedat;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Useranalytics other = (Useranalytics) that;
        return (this.getAnalyticsid() == null ? other.getAnalyticsid() == null : this.getAnalyticsid().equals(other.getAnalyticsid()))
            && (this.getUserid() == null ? other.getUserid() == null : this.getUserid().equals(other.getUserid()))
            && (this.getCounselorid() == null ? other.getCounselorid() == null : this.getCounselorid().equals(other.getCounselorid()))
            && (this.getTotalappointments() == null ? other.getTotalappointments() == null : this.getTotalappointments().equals(other.getTotalappointments()))
            && (this.getCompletedappointments() == null ? other.getCompletedappointments() == null : this.getCompletedappointments().equals(other.getCompletedappointments()))
            && (this.getCanceledappointments() == null ? other.getCanceledappointments() == null : this.getCanceledappointments().equals(other.getCanceledappointments()))
            && (this.getAveragerating() == null ? other.getAveragerating() == null : this.getAveragerating().equals(other.getAveragerating()))
            && (this.getLastconsultation() == null ? other.getLastconsultation() == null : this.getLastconsultation().equals(other.getLastconsultation()))
            && (this.getCreatedat() == null ? other.getCreatedat() == null : this.getCreatedat().equals(other.getCreatedat()))
            && (this.getUpdatedat() == null ? other.getUpdatedat() == null : this.getUpdatedat().equals(other.getUpdatedat()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getAnalyticsid() == null) ? 0 : getAnalyticsid().hashCode());
        result = prime * result + ((getUserid() == null) ? 0 : getUserid().hashCode());
        result = prime * result + ((getCounselorid() == null) ? 0 : getCounselorid().hashCode());
        result = prime * result + ((getTotalappointments() == null) ? 0 : getTotalappointments().hashCode());
        result = prime * result + ((getCompletedappointments() == null) ? 0 : getCompletedappointments().hashCode());
        result = prime * result + ((getCanceledappointments() == null) ? 0 : getCanceledappointments().hashCode());
        result = prime * result + ((getAveragerating() == null) ? 0 : getAveragerating().hashCode());
        result = prime * result + ((getLastconsultation() == null) ? 0 : getLastconsultation().hashCode());
        result = prime * result + ((getCreatedat() == null) ? 0 : getCreatedat().hashCode());
        result = prime * result + ((getUpdatedat() == null) ? 0 : getUpdatedat().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", analyticsid=").append(analyticsid);
        sb.append(", userid=").append(userid);
        sb.append(", counselorid=").append(counselorid);
        sb.append(", totalappointments=").append(totalappointments);
        sb.append(", completedappointments=").append(completedappointments);
        sb.append(", canceledappointments=").append(canceledappointments);
        sb.append(", averagerating=").append(averagerating);
        sb.append(", lastconsultation=").append(lastconsultation);
        sb.append(", createdat=").append(createdat);
        sb.append(", updatedat=").append(updatedat);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}